<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../js/layui/css/layui.css" />
		<link rel="stylesheet" type="text/css" href="../css/common.css" />
		<script src="../js/jquery.min.js"></script>
		<script src="../js/layui/layui.js"></script>
		<script src="../js/common.js"></script>
	</head>

	<body>
		<div style="padding: 20px;">
			<button type="button" onclick="open1()">iframe弹窗</button>
			<button type="button" onclick="xx()">当前窗口信息</button>
			<button type="button" onclick="yy()">关闭当前窗口</button>
			<button type="button" onclick="zz()">关闭打开当前窗口的窗口</button>
			<script type="text/javascript">
				var xx = function() {
					if(window.layerIndex) {
						layerSource && console.log('iframe弹窗发起方 layerSource:', layerSource.document);
						layerIndex && console.log('iframe弹窗layer索引值 layerIndex:', layerIndex);
					}
				};

				var yy = function() {
					if(window.layerIndex) {
						parent.layer.close(layerIndex)
					}
				};
				var zz = function() {
					if(window.layerSource && window.layerSource.layerSource) {
						layerSource.parent.layer.close(layerSource.layerIndex)
					}
				};

				var open1 = function() {
					layer.open({
						type: 2,
						goal: top, //顶层窗口top,父级窗口parent,父级的父级窗口parent.parent
						content: './view-demo/iframe-source-2.html',
						area: ['50%', '50%'],
						success: function() {
							console.log('加载完')
						}
					})
				};
			</script>
		</div>
	</body>

</html>